App.controller('myUpdatePwdController', ['$rootScope', '$scope', '$state', '$window', 'Page', 'settings', 'sessionStore', function($rootScope, $scope, $state, $window, Page, settings, sessionStore) {
		$scope.user = angular.copy($rootScope.user);
		$scope.updatePwd = function(){
			if($scope.user.password == ''){
				$scope.msg = '原密码不能为空'; 
				return false;
			}
			if($scope.user.newPassword == ''){
				$scope.msg = '新密码不能为空'; 
				return false;
			}
			if($scope.user.renewPassword == ''){
				$scope.msg = '请重复填写新密码'; 
				return false;
			}
			if($scope.user.newPassword != $scope.user.renewPassword){
				$scope.msg = '重复密码不一致!'; 
				return false;
			}
			var param = {
				phone : $scope.user.phone,
				password : $.md5($scope.user.password),
				newPassword : $.md5($scope.user.newPassword)
			};
			Page.ajaxPostQuiet(settings.updatePasswordUrl, param, function(resp) {
				Page.alert('密码修改成功!',function(){
					$state.go('user.info');
				});
        	},function(resp){
        		$scope.msg = resp.resultDes; 
        	});
		};
}]);